Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting concurrency for pipelined flush and resolveLocks #1494

Merged
merged 15 commits into from
Jan 16, 2025

Conversation

ekexium
Copy link
Contributor

@ekexium ekexium commented Nov 13, 2024

For tidb variable tidb_pipelined_dml_resource_policy

@ti-chi-bot ti-chi-bot bot added dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 13, 2024
@ekexium ekexium requested review from you06 and cfzjywxk November 14, 2024 03:56
@ekexium ekexium force-pushed the config-flush-concurrency branch from 9935299 to d3adfc2 Compare December 6, 2024 01:26
@ekexium
Copy link
Contributor Author

ekexium commented Dec 10, 2024

@you06 @cfzjywxk PTAL when you have time, thanks

@ekexium ekexium force-pushed the config-flush-concurrency branch from ecf9e34 to 6b75b34 Compare December 10, 2024 13:00
Copy link
Contributor

@cfzjywxk cfzjywxk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 10, 2024
@cfzjywxk
Copy link
Contributor

@you06 PTAL

@@ -1,6 +1,6 @@
module gcworker

go 1.23
go 1.23.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an auto update from IDE? I think go1.23 is enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forget the reason to do so, probably because of compiling or CI stuff. I will revert it

PipelinedMemDB bool
TxnScope string
StartTS *uint64
PipelinedTxn PipelinedTxnOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also modify the initialization of TxnOptions here to use manually specified default properties?

options := &transaction.TxnOptions{}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually sepecifying default values seems a bit strange to me. These fields must be correctly specified by upper layers if they are used. And they have a valid range check when used.
I add validity checks for them before usage. PTAL

txnkv/transaction/txn.go Outdated Show resolved Hide resolved
@@ -481,7 +480,7 @@ func (c *twoPhaseCommitter) resolveFlushedLocks(bo *retry.Backoffer, start, end
fmt.Sprintf("pipelined-dml-%s", status),
fmt.Sprintf("pipelined-dml-%s-%d", status, c.startTS),
c.store,
RESOLVE_CONCURRENCY,
c.txn.pipelinedResolveLockConcurrency,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The throttle flow control works when flushing.

And the resolve-lock phase can also consume many resources, and it may also needs to be controlled by throttle, what about adding a TODO here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throttling the resolve lock goroutine is in our current plan I think. For now we rely on the concurrency to constrain it. If we want a better control of its resource usage we might need to consider a more comprehensive mechanism, e.g. one that helps reduce the overhead of resolving locks of multiple p-txns running in parallel.

txnkv/transaction/txn.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 6, 2025
@ekexium ekexium force-pushed the config-flush-concurrency branch from 4dc212d to 4af7b8b Compare January 6, 2025 08:43
@ekexium ekexium requested a review from you06 January 8, 2025 12:05
@ti-chi-bot ti-chi-bot bot added the lgtm label Jan 16, 2025
Copy link

ti-chi-bot bot commented Jan 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, you06

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jan 16, 2025
Copy link

ti-chi-bot bot commented Jan 16, 2025

[LGTM Timeline notifier]

Timeline:

  • 2024-12-10 13:13:12.375511689 +0000 UTC m=+357782.464314228: ☑️ agreed by cfzjywxk.
  • 2025-01-16 07:38:21.926139388 +0000 UTC m=+190573.381185531: ☑️ agreed by you06.

@ti-chi-bot ti-chi-bot bot merged commit 405d444 into tikv:master Jan 16, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants